/**
 * Ladrillo.
 * @constructor
 * @param {Number} x - pos x.
 * @param {Number} y - pos y.
 * @param {Number} w - anchura (debe corresponder con anchura de sprite).
 * @param {Number} h - altura (debe corresponder con altura de sprite a usar).
 * @param {Number} rx - punto de registro de objeto x.
 * @param {Number} ry - punto de registro de objeto y.
 * @param {Number} scaleX - escala de objeto x (escala de objeto y de sprite a asociar).
 * @param {Number} scaleY - escala de objeto y (escala de objeto y de sprite a asociar).
 * @param {String} imgId - id de imagen de ladrillo a cargar.
 */
function Brick(x, y, w, h, rx, ry, scaleX, scaleY, imgId) {
    this.animation = null;
    GameObject.call(this, x, y, w, h, rx, ry, scaleX, scaleY);
    this.imgId = (imgId) ? imgId : "brick";
};

Brick.prototype = Object.create(GameObject.prototype);

Brick.prototype.loadAnimations = function() {
    var brickImg = GameSys.imgLoader.loadedImages[this.imgId];

    var spriteSheet = new createjs.SpriteSheet({
        images : [brickImg],
        frames : {
            width : this.w,
            height : this.h,
            regX : this.rx,
            regY : this.ry
        },
        animations : {
            idle : [0, 0, "idle", 3]
        }
    });

    var bmpAnimation = new createjs.BitmapAnimation(spriteSheet);

    bmpAnimation.regX = bmpAnimation.spriteSheet.frameWidth / 2 | 0;
    bmpAnimation.regY = bmpAnimation.spriteSheet.frameHeight / 2 | 0;
    //bmpAnimation.regX = 0;
    //bmpAnimation.regY = 0;

    bmpAnimation.scaleX = this.sx;
    bmpAnimation.scaleY = this.sy;

    bmpAnimation.gotoAndPlay("idle");

    bmpAnimation.shadow = new createjs.Shadow("#454", 0, 5, 4);

    // have each monster start at a specific frame
    bmpAnimation.currentFrame = 0;

    this.animation = bmpAnimation;
    this.update();
};
//loadAnimations

